const fs = require('fs');
const path = require('path');

console.log('Start creating projects build entrance and projects folder');

const projectsPath = path.join(__dirname, 'app');
if (!fs.existsSync(projectsPath)) {
    fs.mkdirSync(projectsPath);
    console.log('The projects folder [app] has been successfully created.');
}else{
    console.log('The projects folder [app] already exists.')
}

const infoPath = path.join(__dirname, "app-build-info.js");
if (!fs.existsSync(infoPath)) {
    const templatePath = path.join(__dirname, "template/app-build-info.js.template");
    let buildInfo = fs.readFileSync(templatePath, { encoding: "utf8" });
    fs.writeFileSync(infoPath, buildInfo, { encoding: 'utf8', flag: 'w' });
    console.log('The projects build entrance [app-build-info.js] has been successfully created.');
}else{
    console.log('The projects build entrance [app-build-info.js] already exists.');
}